#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve(){
    int n,k;
    cin>>n>>k;
    if(k==0){
        cout<<string(n,'0')<<endl;
        return;
    }
    if(k==n){
        cout<<string(n,'1')<<endl;
        return;
    }
    string s(n,'0');
    if(k==1)s[0]='1';
    else if(k==2)s[n-2]='1',s[0]='1';
    else {
        for(int i=0;i<k;i++)s[i]='1';
    }
    cout<<s<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--)solve();
    

    return 0;
}